const shop = require('../../providers/dataAccess').shop;

const CategoryService = function () {
  const _getCategoryList = async (appId) => {
    console.log(appId);
    let szSql = "SELECT id,categoryName FROM categories WHERE appId = ? ORDER BY sequence";
    let list = await shop.query(szSql,[appId]);
    if (list && list.length > 0) {
       return list;
    } else {
      return null;
    }
  }

  return {
      list: _getCategoryList
  }

}();

module.exports = CategoryService;
